<include file="Public:header" />
<div class="container main"> <include file="Public:left" />
  <div class="w790">
  <script>
  	function uploaded(path){
		$("#img_url").attr("src",'__PUBLIC__'+path);
		$("input[name='img_url']").val(path);
	}
	function del_img(){
		if(confirm('您确定要删除图片吗?')){
			var file=$("input[name='img_url']").val();
			$.post("{:U('delImgBypath')}",{'path':file},function(data){
				$("input[name='img_url']").val('');
				$("#img_url").attr('src','');
			});
		}else{
			return false;
		}
	}
	//切换栏目方式
	function parseCateType(e){
		if($(e).val()==1){
			$('#pagesize').show();
		}else{
			$('#pagesize').hide();
		}
	}
	function after(e){
	    $(e).parent().parent().parent().parent().parent('li').after($(e).parent().parent().parent().parent().parent('li').prev());
    }
    function append(e){
	    $(e).parent().parent().parent().parent().parent('li').next().after($(e).parent().parent().parent().parent().parent('li'));
    }
	function delnews(e){
		$(e).parent().parent().parent().parent().parent().remove();
	}
	function addnews(){
		var html = $('#copyHTML').html();
		$(html).appendTo('#replyList ul');
	}
  </script>
  <style>
  	#replyList ul li{margin-top:5px; background:#eee; padding:8px; width:700px;}
	.delnews{display:block; width:30px; font-size:20px; height:30px; border-radius:15px; background:#f00; color:#fff; line-height:30px; text-align:center;}
  </style>

  <div class="h"><a href="{:U('index')}" class="btn btn-info"><i class="glyphicon glyphicon-circle-arrow-left"></i> 返回列表</a>
 
 </div>
    <form class="checkoutform" action="{:U('insert')}" method="post">
      <div class="table_"><table class="table table-bordered" width="100%" border="0" cellspacing="0" cellpadding="0">
        
        <div class="form-group">
      <label class="col-sm-2 control-label">标题</label>
      <div class="col-sm-10">
         <input class="form-control" datatype="*"  name="title" type="text" >
      </div>
   </div>
      <div class="form-group">
      <label class="col-sm-2 control-label">内容</label>
      <div class="col-sm-10">
         <html:editor id="editor" name="content" type="UEDIT" style="height:400px; width:100%;"></html:editor>
      </div>
   </div>
      
      <if condition="APP_DEBUG">      </if>
      <tr>
        <td align="right">可选项</td>
        <td id="replyList"><ul>
          <volist name="selectList" id="vo">
            <li>
              <table class="table table-bordered" width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td>选项：
                    <input type="text" size="70" name="subtitle[]" value="{$vo.title}" /></td>
                  
                  <td rowspan="2"><input type="hidden" name="img_path[]" value="{$vo.img_path}" />
                    <img src="<notempty name="vo['img_path']">{:getThumbPath($vo['img_path'])}
                    <else/>
                    __PUBLIC__/Admin/images/defaultimg.png
                    </notempty>
                    " onclick="showImgBox(this);" height="40" width="40" /></td>
                  <td rowspan="2"><a href="javascript:void(0);" onclick="after(this);">上</a><a href="javascript:void(0);" onclick="append(this);">下</a></td>
                  <td rowspan="2"><a class="delnews" href="javascript:void(0);" onclick="delnews(this);">×</a></td>
                  </tr>
                <tr>
                  <td>答案：
                    <input type="text" name="answer[]" value="{$vo.answer}" size="70" /></td>
                  </tr>
                </table>
              </li>
            </volist>
          </ul>
          <a href="javascript:;" onclick="addnews();" style="display:inline-block;" class="mybutton">添加</a></td>
      </tr>
      
        
      </table><div class="pages"><button type="submit" class="btn btn-success">提交</button></div>
    </form>
  </div>
  <div class="clear"></div>
</div>
<ul id="copyHTML" style="display:none;">
              <li>
                  <table class="table table-bordered" width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td>选项：
                    <input type="text" size="70" name="subtitle[]" value="" /></td>
                  
                  <td rowspan="2"><input type="hidden" name="img_path[]" value="" />
                    <img src="
                    __PUBLIC__/Admin/images/defaultimg.png
                    
                    " onclick="showImgBox(this);" height="40" width="40" /></td>
                  <td rowspan="2"><a href="javascript:void(0);" onclick="after(this);">上</a><a href="javascript:void(0);" onclick="append(this);">下</a></td>
                  <td rowspan="2"><a class="delnews" href="javascript:void(0);" onclick="delnews(this);">×</a></td>
                  </tr>
                <tr>
                  <td>答案：
                    <input type="text" name="answer[]" value="" size="70" /></td>
                  </tr>
                </table>
                </li>
              </ul>
</body></html>